# Contributor: Russ Webber <russ@rw.id.au>
# Maintainer: Russ Webber <russ@rw.id.au>
pkgname=py3-catkin-pkg
_pkgname=catkin_pkg
pkgver=0.5.2
pkgrel=4
pkgdesc="Standalone Python library for the catkin build system."
url="http://wiki.ros.org/catkin_pkg"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-docutils py3-dateutil py3-parsing"
makedepends="py3-setuptools py3-gpep517"
checkdepends="py3-pytest py3-mock"
subpackages="$pkgname-pyc"
source="https://github.com/ros-infrastructure/catkin_pkg/archive/refs/tags/$pkgver/catkin-pkg-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py3-catkin-pkg-modules" # module was renamed in pypi
provides="py3-catkin-pkg-modules=$pkgver-r$pkgrel"

prepare() {
	default_prepare
	# skip lint checks
	rm test/test_flake8.py
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest test/test_*.py
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
40e7e3839017ad430ee36dccf87a90727e5efd92e6c605cdba3e9f8850b71a6a80da79bd8760d94e356dadebdd842c8a3f8b530782fb75503d3e620add79be4a  catkin-pkg-0.5.2.tar.gz
"
